package com.apanal.qlife.sys.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.apanal.qlife.common.page.Page;
import com.apanal.qlife.common.page.PageReturn;
import com.apanal.qlife.sys.dao.AreaMapper;
import com.apanal.qlife.sys.model.Area;
import com.apanal.qlife.sys.service.AreaService;

/**
 * @author Admin
 * 
 */
@Service
public class AreaServiceImpl implements AreaService {

	@Autowired
	private AreaMapper mapper;

	public List<Area> findAreaList(Area area) {
		return mapper.findAreaList(area);
	}

	@Override
	public PageReturn<Area> selectRelationForPage(Area area, Page page) {
		int count = mapper.selectRelationForPageCount(area, page);
		List<Area> list = mapper.selectRelationForPage(area, page);
		return new PageReturn<Area>(list, count, page, area);
	}

	@Override
	public List<Area> selectByIds(String ids) {
		if (ids == null || "".equals(ids)) {
			return null;
		} else {
			Area param = new Area();
			param.setAreids(ids);
			return mapper.select(param);
		}
	}

}
